controllingCase
Strings Sandbox MichS Revised

Controlling Case

Problem
=======

By  default, case-sensitivty  is in  effect when  awk performs  string  
comparionsons.

Solution
========

If you  need to  control the case  of a given  string, you  have three
choices. The first  two work with most implementations of  awk as well
as gawk.  The first method  uses the tolower() function  which returns
all charecters supplied as a lowercase string.

  result = tolower("FooBar")

Now the string variable 'result' equals 'foobar'.

Conversely,  the toupper()  function, will  return all  the characters
supplied as an uppercase string:

  RESULT = toupper("FooBar")

Now the string variable 'RESULT' equals 'FOOBAR'.

The third method  is specific to GNU  gawk, and is used  in a slightly
different manner:

  BEGIN{IGNORECASE = 1}
   
In the example above, we're using the special gawk built-in IGNORECASE
which  when set  to any  non-zero value,  tells gawk  to discard  case
sensitivity  when performing  string comparisons  throughout your  awk
program  file.  Typically  (but  not   always),  you'll  want  to  use
IGNORECASE within the BEGIN{} block of your program file.

